package Shopping;

import java.util.*;
import Shopping.Allgoods;
import Shopping.Shoppingcart;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int sum=0;
		Allgoods sa;
		int m = in.nextInt();
		for(int i=0;i<m;i++) {
			sa = new Allgoods(in.next(),in.nextInt(),in.next(),in.nextInt());
			
		}
		Allgoods.Display();
		
		Shoppingcart ss;
		int n = in.nextInt();
		for(int i=0;i<n;i++) {
			ss = new Shoppingcart(in.next(),in.nextInt(),in.next(),in.nextInt());
			
		}
		Shoppingcart.Display();
		
	}
}
